
-- insert initial data

--Table Module
insert into [module](id,name,plugin_id,param,init_string) values('FunctionMgr','FunctionMgr','FunctionMgr','','')
go

insert into [module](id,name,plugin_id,param,init_string) values('ModuleMgr','ModuleMgr','ModuleMgr','','')
go

insert into [module](id,name,plugin_id,param,init_string) values('PluginMgr','PluginMgr','PluginMgr','','')
go

insert into [module](id,name,plugin_id,param,init_string) values('RoleMgr','RoleMgr','RoleMgr','','')
go

insert into [module](id,name,plugin_id,param,init_string) values('UserMgr','UserMgr','UserMgr','','')
go


--Table Function
insert into [function](id,name,type_id,parent_id) values('\','\','normal',null)
go

insert into [function](id,name,type_id,parent_id) values('\\System','System','normal','\')
go

insert into [function](id,name,type_id,parent_id) values('\\System\FunctionMgr','Function Manager','module','\\System')
go

insert into [function](id,name,type_id,parent_id) values('\\System\ModuleMgr','Module Manager','module','\\System')
go

insert into [function](id,name,type_id,parent_id) values('\\System\PluginMgr','Plugin Manager','module','\\System')
go

insert into [function](id,name,type_id,parent_id) values('\\System\RoleMgr','Role Manager','module','\\System')
go

insert into [function](id,name,type_id,parent_id) values('\\System\UserMgr','User Manager','module','\\System')			
go


--Table Function_Module
insert into function_module(function_id,module_id) values('\\System\FunctionMgr','FunctionMgr')
go

insert into function_module(function_id,module_id) values('\\System\ModuleMgr','ModuleMgr')
go

insert into function_module(function_id,module_id) values('\\System\PluginMgr','PluginMgr')
go

insert into function_module(function_id,module_id) values('\\System\RoleMgr','RoleMgr')
go

insert into function_module(function_id,module_id) values('\\System\UserMgr','UserMgr')
go


--Table User
insert into [user](id,name,description,password,auth_type) values('admin','admin','','admin','local')
go

--Table Role
go

insert into role(id,name,description) values('admins','admins','')
go

--Table user_role
insert into user_role(user_id,role_id) values('admin','admins')
go

--Table Function_Authorization
insert into function_authorization(id,function_id,role_id) values('1','\\System','admins')
go

insert into function_authorization(id,function_id,role_id) values('2','\\System\FunctionMgr','admins')
go

insert into function_authorization(id,function_id,role_id) values('3','\\System\ModuleMgr','admins')
go

insert into function_authorization(id,function_id,role_id) values('4','\\System\PluginMgr','admins')
go

insert into function_authorization(id,function_id,role_id) values('5','\\System\RoleMgr','admins')
go

insert into function_authorization(id,function_id,role_id) values('6','\\System\UserMgr','admins')
go

insert into globalvariables values('startup.plugin_ids','FunctionBrowser')
go